<?php
class organization_mdl_organization extends dbeav_model{

//     var $export_name = '企业组织架构';
    var $org_status = array(
        1 => "启用",
        2 => "停用",
    );
    
    //企业组织管理页面显示状态
    public function modifier_status($row){
        return $this->org_status[$row];
    }
    
    public function modifier_org_type($row){
        if($row == 2){
            return '门店';
        }else{
            return '-';
        }
    }
    
    //上级组织编码
    public function modifier_parent_no($row){
        if(!$row){
            return '-';
        }else{
            return $row;
        }
    }
    
    //下级组织编码
    public function modifier_child_nos($row){
        if(!$row){
            return '-';
        }else{
            return $row;
        }
    }
    
    //下级组织名称
    public function modifier_child_names($row){
        if(!$row){
            return '-';
        }else{
            return $row;
        }
    }
    
    //导出
//     public function exportName(&$data){
//         $data['name'] = $this->export_name.date("Y-m-d H:i:s");
//     }
    
    //输出头标题和数据
//     function fgetlist_csv( &$data,$filter,$offset,$exportType = 1 ){
//         if( !$data['title']){
//             $title = array();
//             foreach($this->io_title('organization') as $k => $v ){
//                 $title[] = $this->charset->utf2local($v);
//             }
//             $data['title']['organization'] = '"'.implode('","',$title).'"';
//         }
//         if( !$list=$this->getlist('*',$filter,0,-1) )return false;
//         foreach( $list as $aFilter ){
//             $pRow = array();
//             $detail['org_id'] = $this->charset->utf2local($aFilter['org_id']);
//             $detail['org_name'] = $this->charset->utf2local($aFilter['org_name']);
//             $detail['org_level_num'] = $this->charset->utf2local($aFilter['org_level_num']);
//             $detail['higher_level_id'] = $this->charset->utf2local($aFilter['higher_level_id']);
//             $detail['lower_level_ids'] = $this->charset->utf2local($aFilter['lower_level_ids']); //需要replace ,
//             $detail['lower_level_names'] = $this->charset->utf2local($aFilter['lower_level_names']); //需要replace ,
//             $detail['status'] = $this->charset->utf2local($this->org_status[$aFilter['status']]);
//             foreach( $this->oSchema['csv']['organization'] as $k => $v ){
//                 $pRow[$k] =  utils::apath( $detail,explode('/',$v) );
//             }
//             $data['contents']['organization'][] = implode(',',$pRow);
//         }
//         return false;
//     }
    
//     function export_csv($data,$exportType = 1 ){
//         $output = array();
//         $output[] = $data['title']['organization']."\n".implode("\n",(array)$data['contents']['organization']);
//         echo implode("\n",$output);
//     }
    
      //头标题
//     function io_title( $filter, $ioType='csv' ){
//         switch( $filter ){
//             case 'organization':
//                 $this->oSchema['csv'][$filter] = array(
//                     '*:组织ID' => 'org_id',
//                     '*:组织名称' => 'org_name',
//                     '*:组织层级' => 'org_level_num',
//                     '*:上级ID' => 'higher_level_id',
//                     '*:下级ID' => 'lower_level_ids',
//                     '*:下级ID名称' => 'lower_level_names',
//                     '*:状态' => 'status',
//                 );
//             break;
//         }
//         $this->ioTitle[$ioType][$filter] = array_keys( $this->oSchema[$ioType][$filter] );
//         return $this->ioTitle[$ioType][$filter];
//     }

}